type ParseResult = string | undefined

// 解析登录页面的验证码
const codeParser = (str: string): ParseResult => str?.match(/(?<=&nbsp;&nbsp;)\d{4}/)?.[0]
// 解析页面的响应结果
const responsParser = (str: string): ParseResult => str?.match(/(?<=alert\(').+?(?=[。，\!])/)?.[0]?.replace(/【|】/g, '')
// 解析登陆后页面上的用户id
const idParser = (str: string): ParseResult => str?.match(/(?<=changeIframe\('.+?\.asp\?id=)\w{44}(?=')/)?.[0]
// 解析登陆后页面上的用户姓名
const nameParser = (str: string): ParseResult => str?.match(/(?<=class\="logged-user-name"\>\s+?)\S+?(?=\s+?\<\/div\>)/)?.[0]
// 解析登陆后页面上的班级
const gradeClassParser = (str: string): ParseResult => str?.match(/(?<=class\="logged-user-role"\>\s+?)\S+?(?=\s+?\<\/div\>)/)?.[0]

export { codeParser, responsParser, idParser, nameParser, gradeClassParser }
